package day1024_3;

import java.util.Scanner;

public class ScoreOutException  extends  Exception{
    ScoreOutException(String msg){
        super(msg);
    }
}

class Test{
    public static void main(String[] args) {
        try {
            test1();
        } catch (ScoreOutException e) {
            System.out.println(e.getMessage());//e.getMessage()： 只获取异常对象中的文字"成绩无效"
        }
    }

    private static void test1()throws  ScoreOutException{
        Scanner sc=new Scanner(System.in);
        System.out.println("请录入您的成绩：");
        double score=sc.nextDouble();
        if(score<0  ||  score>100){
            throw  new ScoreOutException("成绩无效");
        }
    }
}
